/**
 * Created by linyanshi  on 2017/6/8 0008.
 */

import kafka.javaapi.producer.Producer;
import kafka.producer.KeyedMessage;
import kafka.producer.ProducerConfig;

import java.util.Properties;


public class KafkaProducer {
    private final Producer<String, String> producer;
//    public final static String TOPIC = "logCollect_cleanData";
    public final static String TOPIC = "topic_creditloan_orderinfo_wait_score";

    private KafkaProducer() {
        Properties props = new Properties();
        //此处配置的是kafka的端口
        props.put("metadata.broker.list", "192.168.0.211:9092,192.168.0.212:9092");

        //配置value的序列化类
        props.put("serializer.class", "kafka.serializer.StringEncoder");
        //配置key的序列化类
        props.put("key.serializer.class", "kafka.serializer.StringEncoder");

        //request.required.acks
        //0, which means that the producer never waits for an acknowledgement from the broker (the same behavior as 0.7). This option provides the lowest latency but the weakest durability guarantees (some data will be lost when a server fails).
        //1, which means that the producer gets an acknowledgement after the leader replica has received the data. This option provides better durability as the client waits until the server acknowledges the request as successful (only messages that were written to the now-dead leader but not yet replicated will be lost).
        //-1, which means that the producer gets an acknowledgement after all in-sync replicas have received the data. This option provides the best durability, we guarantee that no messages will be lost as long as at least one in sync replica remains.
        props.put("request.required.acks", "-1");

        producer = new Producer<String, String>(new ProducerConfig(props));
    }

    void produce() {
//        int messageNo = 1000;
        int messageNo = 0;
        final int COUNT = 1;
//        final int COUNT = 100000;

        while (messageNo < COUNT) {
            String key = String.valueOf(messageNo);
//            String data = "hello kafka message " + key;
//            String data = "{\"bizNo\":\"generalApply\",\"bizType\":\"INTERFACE\",\"bizTypeEnum\":\"BizTypeEnum_INTERFACE\",\"channelEnum\":\"ChannelEnum_APP\",\"channelId\":\"APP\",\"collectTime\":1498185434324,\"desensitizeFlatMap\":{\"_Platform\":\"android\",\"userid\":\"1002531759\",\"orderno\":\"XNA20170623103443002521319585518\",\"lbsy\":\"121.431546\",\"lbsx\":\"31.162964\",\"_Manufacturer\":\"samsung\",\"insertTime\":\"2017-06-23 10:37:14\",\"emergencymobile\":\"1b3dbf8a0ef2fc3536fa442df107710b\",\"hostName\":\"creditloan02\",\"lbsProvince\":\"上海市\",\"channelId\":\"APP\",\"businesstype\":\"YFQ\",\"applyamt\":\"3400000\",\"periodStep\":\"1\",\"ocrcertno\":\"ede514c1655bcebf83b5cbedeb9f0e8a\",\"receiveTime\":1498185434375,\"collectTimeFmt\":\"2017-06-23 10:37:14\",\"busid\":\"applygeneralloan\",\"contactmobile\":\"772bd5ac21cc73ba5a560e6f95de2ff2\",\"bizTypeEnum\":\"BizTypeEnum_INTERFACE\",\"ver\":\"94\",\"certno\":\"ede514c1655bcebf83b5cbedeb9f0e8a\",\"modelNo\":\"CreditGateway\",\"debitbank\":\"6974ce5ac660610b44d9b9fed0ff9548\",\"operateTypeEnum\":\"OperateTypeEnum_ADD\",\"telecode\":\"98f0ad391c70d3cf46948315986581dc\",\"belongCity\":\"上海市\",\"apcrnames\":\"2e5ae9046909f028d32aff70d4a9fecc\",\"CREDIT_PRODUCTNO\":\"PK03\",\"sid\":\"LAKALAYD000201706233712000905831\",\"lbsanalyzed\":\"f35289cde042115338ce7ee85b7e5a67\",\"stepUnit\":\"M\",\"curcode\":\"156\",\"systemCode\":\"CreditLoan\",\"companyname\":\"963dc7ea03055e6e0b7fa83335e8c2ea\",\"process\":\"18671@creditloan02\",\"collectTime\":1498185434324,\"channelsource\":\"A\",\"belongRegion\":\"徐汇区\",\"productNo\":\"YFQ\",\"ocrname\":\"6140c87f7e2c6d21596aa975be439e7b\",\"applyId\":\"17184712\",\"hostIp\":\"10.1.91.28\",\"contactrelation\":\"4\",\"_DeviceModel\":\"SM-G9250\",\"_MacWifi\":\"02:00:00:00:00:00\",\"isAgree\":\"Y\",\"receiveTimeFmt\":\"2017-06-23 10:37:14\",\"_DeviceId\":\"359596061052209\",\"registerorg\":\"上海市公安局闸北分局\",\"dataPlatformCertnoGender\":\"M\",\"belongProvince\":\"上海市\",\"fingerprinttab\":\"442a06a996454fc9b8086a29c2c688d7\",\"msgmobile\":\"bdaa9bf872b7bb2ec92ccf3d01bbbb28\",\"smscode\":\"753166\",\"operateType\":\"ADD\",\"dataPlatformCertnoProvince\":\"上海\",\"cpcrcodes\":\"310000|310100|310101\",\"period\":\"12\",\"nation\":\"汉\",\"protocolVersion\":\"1.0.5\",\"userfullife\":\"20150508-20350508\",\"email\":\"515a226df42fb76419aa595e531563ee\",\"sessionId\":\"XNA2017062317184712\",\"applicant\":\"6140c87f7e2c6d21596aa975be439e7b\",\"bizType\":\"INTERFACE\",\"merchantNo\":\"CreditLoan\",\"debitcard\":\"7aadf6b51e4ad4ce198aabc6eba6a7cf\",\"channelEnum\":\"ChannelEnum_APP\",\"mobile\":\"bdaa9bf872b7bb2ec92ccf3d01bbbb28\",\"ipv4\":\"101.228.13.47\",\"sex\":\"男\",\"emergencyrelation\":\"3\",\"apcrcodes\":\"310000|310100|310104\",\"cpcrnames\":\"上海市|上海市|黄浦区\",\"bizNo\":\"generalApply\",\"dataPlatformCertnoBirthday\":\"19820930\",\"emergencyname\":\"78deb65a17e22d4279751cfd35c4a469\",\"logNo\":\"generalApply_CreditLoan\",\"termid\":\"CBC3A11002531759\",\"companyaddress\":\"b8c36d5e439570b47350b5ddb9014ccb\",\"address\":\"56a6e6736b6d525bab666218b59a5163\",\"contactname\":\"7c086a2117384200cca1a03da6a0ca8c\",\"registered\":\"d8cbe1054d9f42b642c34b3c5b152bbb\",\"innerSessionId\":\"51F30FC018DF44B4A8A8253219EA4661\",\"companytel\":\"415140542735e35e8ccb8f3fc9d824ae\",\"channel\":\"APP\",\"productName\":\"易分期还款12个月（新）\",\"lbs\":\"609c28293cbed2b704fbfc274fb6fa41\"},\"extendMap\":{},\"fields\":[{\"key\":\"productNo\",\"value\":\"YFQ\"},{\"key\":\"ocrname\",\"value\":\"周佳庆\"},{\"key\":\"_Platform\",\"value\":\"android\"},{\"key\":\"hostIp\",\"value\":\"10.1.91.28\"},{\"key\":\"contactrelation\",\"value\":\"4\"},{\"key\":\"userid\",\"value\":\"1002531759\"},{\"key\":\"_MacWifi\",\"value\":\"02:00:00:00:00:00\"},{\"key\":\"orderno\",\"value\":\"XNA20170623103443002521319585518\"},{\"key\":\"lbsy\",\"value\":\"121.431546\"},{\"key\":\"lbsx\",\"value\":\"31.162964\"},{\"key\":\"receiveTimeFmt\",\"value\":\"2017-06-23 10:37:14\"},{\"key\":\"_DeviceId\",\"value\":\"359596061052209\"},{\"key\":\"emergencymobile\",\"value\":\"18602111324\"},{\"key\":\"registerorg\",\"value\":\"上海市公安局闸北分局\"},{\"key\":\"hostName\",\"value\":\"creditloan02\"},{\"key\":\"belongProvince\",\"value\":\"上海市\"},{\"key\":\"fingerprinttab\",\"value\":\"442a06a996454fc9b8086a29c2c688d7\"},{\"key\":\"lbsProvince\",\"value\":\"上海市\"},{\"key\":\"msgmobile\",\"value\":\"13501784931\"},{\"key\":\"smscode\",\"value\":\"753166\"},{\"key\":\"channelId\",\"value\":\"APP\"},{\"key\":\"businesstype\",\"value\":\"YFQ\"},{\"key\":\"applyamt\",\"value\":\"3400000\"},{\"key\":\"cpcrcodes\",\"value\":\"310000|310100|310101\"},{\"key\":\"nation\",\"value\":\"汉\"},{\"key\":\"userfullife\",\"value\":\"20150508-20350508\"},{\"key\":\"email\",\"value\":\"68087825@qq.com\"},{\"key\":\"sessionId\",\"value\":\"XNA2017062317184712\"},{\"key\":\"ocrcertno\",\"value\":\"510524199507105477\"},{\"key\":\"applicant\",\"value\":\"周佳庆\"},{\"key\":\"receiveTime\",\"value\":\"2017-06-23 10:37:14\"},{\"key\":\"bizType\",\"value\":\"INTERFACE\"},{\"key\":\"merchantNo\",\"value\":\"CreditLoan\"},{\"key\":\"debitcard\",\"value\":\"6228480038388476970\"},{\"key\":\"channelEnum\",\"value\":\"APP_APP渠道\"},{\"key\":\"collectTimeFmt\",\"value\":\"2017-06-23 10:37:14\"},{\"key\":\"busid\",\"value\":\"applygeneralloan\"},{\"key\":\"mobile\",\"value\":\"13501784931\"},{\"key\":\"ipv4\",\"value\":\"101.228.13.47\"},{\"key\":\"sex\",\"value\":\"男\"},{\"key\":\"contactmobile\",\"value\":\"13764087955\"},{\"key\":\"bizTypeEnum\",\"value\":\"INTERFACE_接口日志类型\"},{\"key\":\"emergencyrelation\",\"value\":\"3\"},{\"key\":\"ver\",\"value\":\"94\"},{\"key\":\"certno\",\"value\":\"510524199507105477\"},{\"key\":\"apcrcodes\",\"value\":\"310000|310100|310104\"},{\"key\":\"modelNo\",\"value\":\"CreditGateway\"},{\"key\":\"debitbank\",\"value\":\"103\"},{\"key\":\"cpcrnames\",\"value\":\"上海市|上海市|黄浦区\"},{\"key\":\"telecode\",\"value\":\"100290014389785\"},{\"key\":\"belongCity\",\"value\":\"上海市\"},{\"key\":\"apcrnames\",\"value\":\"上海市|上海市|徐汇区\"},{\"key\":\"bizNo\",\"value\":\"generalApply\"},{\"alias\":\"CREDIT_PRODUCTNO\",\"key\":\"CREDIT_PRODUCTNO\",\"value\":\"PK03\"},{\"key\":\"sid\",\"value\":\"LAKALAYD000201706233712000905831\"},{\"key\":\"lbsanalyzed\",\"value\":\"上海市徐汇区宾南路\"},{\"key\":\"emergencyname\",\"value\":\"梅伯迅\"},{\"key\":\"logNo\",\"value\":\"generalApply_CreditLoan\"},{\"key\":\"termid\",\"value\":\"CBC3A11002531759\"},{\"key\":\"curcode\",\"value\":\"156\"},{\"key\":\"systemCode\",\"value\":\"CreditLoan\"},{\"key\":\"companyaddress\",\"value\":\"延安东路333号1801室\"},{\"key\":\"companyname\",\"value\":\"上海市金睿投资管理有限公司\"},{\"key\":\"process\",\"value\":\"18671@creditloan02\"},{\"key\":\"collectTime\",\"value\":\"2017-06-23 10:37:14\"},{\"key\":\"address\",\"value\":\"宾南路36弄8号1703室\"},{\"key\":\"contactname\",\"value\":\"万春红\"},{\"key\":\"channelsource\",\"value\":\"A\"},{\"key\":\"registered\",\"value\":\"上海市闸北区共和新路708弄1号1310室\"},{\"key\":\"belongRegion\",\"value\":\"徐汇区\"},{\"key\":\"companytel\",\"value\":\"021-66288696\"},{\"key\":\"lbs\",\"value\":\"\\\"{\\\\\\\"lbsy\\\\\\\":\\\\\\\"121.431546\\\\\\\",\\\\\\\"lbsx\\\\\\\":\\\\\\\"31.162964\\\\\\\",\\\\\\\"lbsanalyzed\\\\\\\":\\\\\\\"上海市徐汇区宾南路\\\\\\\"}\\\"\"}],\"flatMap\":{\"productNo\":\"YFQ\",\"ocrname\":\"周佳庆\",\"applyId\":\"17184712\",\"_Platform\":\"android\",\"hostIp\":\"10.1.91.28\",\"contactrelation\":\"4\",\"_DeviceModel\":\"SM-G9250\",\"userid\":\"1002531759\",\"_MacWifi\":\"02:00:00:00:00:00\",\"orderno\":\"XNA20170623103443002521319585518\",\"isAgree\":\"Y\",\"lbsy\":\"121.431546\",\"lbsx\":\"31.162964\",\"_Manufacturer\":\"samsung\",\"receiveTimeFmt\":\"2017-06-23 10:37:14\",\"_DeviceId\":\"359596061052209\",\"insertTime\":\"2017-06-23 10:37:14\",\"emergencymobile\":\"18602111324\",\"registerorg\":\"上海市公安局闸北分局\",\"dataPlatformCertnoGender\":\"M\",\"hostName\":\"creditloan02\",\"belongProvince\":\"上海市\",\"fingerprinttab\":\"442a06a996454fc9b8086a29c2c688d7\",\"lbsProvince\":\"上海市\",\"msgmobile\":\"13501784931\",\"smscode\":\"753166\",\"operateType\":\"ADD\",\"channelId\":\"APP\",\"businesstype\":\"YFQ\",\"dataPlatformCertnoProvince\":\"上海\",\"applyamt\":\"3400000\",\"cpcrcodes\":\"310000|310100|310101\",\"period\":\"12\",\"nation\":\"汉\",\"periodStep\":\"1\",\"protocolVersion\":\"1.0.5\",\"userfullife\":\"20150508-20350508\",\"email\":\"68087825@qq.com\",\"sessionId\":\"XNA2017062317184712\",\"ocrcertno\":\"510524199507105477\",\"applicant\":\"周佳庆\",\"receiveTime\":1498185434375,\"bizType\":\"INTERFACE\",\"merchantNo\":\"CreditLoan\",\"debitcard\":\"6228480038388476970\",\"channelEnum\":\"ChannelEnum_APP\",\"collectTimeFmt\":\"2017-06-23 10:37:14\",\"busid\":\"applygeneralloan\",\"mobile\":\"13501784931\",\"ipv4\":\"101.228.13.47\",\"sex\":\"男\",\"contactmobile\":\"13764087955\",\"bizTypeEnum\":\"BizTypeEnum_INTERFACE\",\"emergencyrelation\":\"3\",\"ver\":\"94\",\"certno\":\"510524199507105477\",\"apcrcodes\":\"310000|310100|310104\",\"modelNo\":\"CreditGateway\",\"debitbank\":\"103\",\"operateTypeEnum\":\"OperateTypeEnum_ADD\",\"cpcrnames\":\"上海市|上海市|黄浦区\",\"telecode\":\"100290014389785\",\"belongCity\":\"上海市\",\"apcrnames\":\"上海市|上海市|徐汇区\",\"bizNo\":\"generalApply\",\"CREDIT_PRODUCTNO\":\"PK03\",\"dataPlatformCertnoBirthday\":\"19820930\",\"sid\":\"LAKALAYD000201706233712000905831\",\"lbsanalyzed\":\"上海市徐汇区宾南路\",\"emergencyname\":\"梅伯迅\",\"stepUnit\":\"M\",\"logNo\":\"generalApply_CreditLoan\",\"termid\":\"CBC3A11002531759\",\"curcode\":\"156\",\"systemCode\":\"CreditLoan\",\"companyaddress\":\"延安东路333号1801室\",\"companyname\":\"上海市金睿投资管理有限公司\",\"process\":\"18671@creditloan02\",\"collectTime\":1498185434324,\"address\":\"宾南路36弄8号1703室\",\"contactname\":\"万春红\",\"channelsource\":\"A\",\"registered\":\"上海市闸北区共和新路708弄1号1310室\",\"belongRegion\":\"徐汇区\",\"innerSessionId\":\"51F30FC018DF44B4A8A8253219EA4661\",\"companytel\":\"021-66288696\",\"channel\":\"APP\",\"productName\":\"易分期还款12个月（新）\",\"lbs\":\"\\\"{\\\\\\\"lbsy\\\\\\\":\\\\\\\"121.431546\\\\\\\",\\\\\\\"lbsx\\\\\\\":\\\\\\\"31.162964\\\\\\\",\\\\\\\"lbsanalyzed\\\\\\\":\\\\\\\"上海市徐汇区宾南路\\\\\\\"}\\\"\"},\"hostIp\":\"10.1.91.28\",\"hostName\":\"creditloan02\",\"innerSessionId\":\"51F30FC018DF44B4A8A8253219EA4661\",\"logConent\":\"{\\\"ocrname\\\":\\\"周佳庆\\\",\\\"_Platform\\\":\\\"android\\\",\\\"contactrelation\\\":\\\"4\\\",\\\"_DeviceModel\\\":\\\"SM-G9250\\\",\\\"_MacWifi\\\":\\\"02:00:00:00:00:00\\\",\\\"userid\\\":\\\"1002531759\\\",\\\"orderno\\\":\\\"XNA20170623103443002521319585518\\\",\\\"isAgree\\\":\\\"Y\\\",\\\"_Manufacturer\\\":\\\"samsung\\\",\\\"_DeviceId\\\":\\\"359596061052209\\\",\\\"registerorg\\\":\\\"上海市公安局闸北分局\\\",\\\"emergencymobile\\\":\\\"18602111324\\\",\\\"brithday\\\":\\\"1982-09-30\\\",\\\"fingerprinttab\\\":\\\"442a06a996454fc9b8086a29c2c688d7\\\",\\\"msgmobile\\\":\\\"13501784931\\\",\\\"smscode\\\":\\\"753166\\\",\\\"productno\\\":\\\"PK03\\\",\\\"businesstype\\\":\\\"YFQ\\\",\\\"applyamt\\\":\\\"3400000\\\",\\\"cpcrcodes\\\":\\\"310000|310100|310101\\\",\\\"period\\\":\\\"12\\\",\\\"nation\\\":\\\"汉\\\",\\\"userfullife\\\":\\\"20150508-20350508\\\",\\\"email\\\":\\\"68087825@qq.com\\\",\\\"applicant\\\":\\\"周佳庆\\\",\\\"ocrcertno\\\":\\\"510524199507105477\\\",\\\"debitcard\\\":\\\"6228480038388476970\\\",\\\"mobile\\\":\\\"13501784931\\\",\\\"busid\\\":\\\"applygeneralloan\\\",\\\"sex\\\":\\\"男\\\",\\\"ipv4\\\":\\\"101.228.13.47\\\",\\\"contactmobile\\\":\\\"13764087955\\\",\\\"emergencyrelation\\\":\\\"3\\\",\\\"ver\\\":\\\"94\\\",\\\"apcrcodes\\\":\\\"310000|310100|310104\\\",\\\"certno\\\":\\\"510524199507105477\\\",\\\"debitbank\\\":\\\"103\\\",\\\"telecode\\\":\\\"100290014389785\\\",\\\"cpcrnames\\\":\\\"上海市|上海市|黄浦区\\\",\\\"apcrnames\\\":\\\"上海市|上海市|徐汇区\\\",\\\"sid\\\":\\\"LAKALAYD000201706233712000905831\\\",\\\"emergencyname\\\":\\\"梅伯迅\\\",\\\"termid\\\":\\\"CBC3A11002531759\\\",\\\"curcode\\\":\\\"156\\\",\\\"companyaddress\\\":\\\"延安东路333号1801室\\\",\\\"companyname\\\":\\\"上海市金睿投资管理有限公司\\\",\\\"contactname\\\":\\\"万春红\\\",\\\"address\\\":\\\"宾南路36弄8号1703室\\\",\\\"channelsource\\\":\\\"A\\\",\\\"registered\\\":\\\"上海市闸北区共和新路708弄1号1310室\\\",\\\"companytel\\\":\\\"021-66288696\\\",\\\"channel\\\":\\\"APP\\\",\\\"lbs\\\":\\\"\\\\\\\"{\\\\\\\\\\\\\\\"lbsy\\\\\\\\\\\\\\\":\\\\\\\\\\\\\\\"121.431546\\\\\\\\\\\\\\\",\\\\\\\\\\\\\\\"lbsx\\\\\\\\\\\\\\\":\\\\\\\\\\\\\\\"31.162964\\\\\\\\\\\\\\\",\\\\\\\\\\\\\\\"lbsanalyzed\\\\\\\\\\\\\\\":\\\\\\\\\\\\\\\"上海市徐汇区宾南路\\\\\\\\\\\\\\\"}\\\\\\\"\\\",\\\"periodStep\\\":\\\"1\\\",\\\"stepUnit\\\":\\\"M\\\",\\\"productName\\\":\\\"易分期还款12个月（新）\\\",\\\"insertTime\\\":\\\"2017-06-23 10:37:14\\\",\\\"applyId\\\":\\\"17184712\\\"}\",\"logNo\":\"generalApply_CreditLoan\",\"map\":{\"applyId\":\"17184712\",\"ocrname\":\"周佳庆\",\"_Platform\":\"android\",\"contactrelation\":\"4\",\"_DeviceModel\":\"SM-G9250\",\"_MacWifi\":\"02:00:00:00:00:00\",\"userid\":\"1002531759\",\"orderno\":\"XNA20170623103443002521319585518\",\"isAgree\":\"Y\",\"_Manufacturer\":\"samsung\",\"_DeviceId\":\"359596061052209\",\"insertTime\":\"2017-06-23 10:37:14\",\"registerorg\":\"上海市公安局闸北分局\",\"emergencymobile\":\"18602111324\",\"brithday\":\"1982-09-30\",\"fingerprinttab\":\"442a06a996454fc9b8086a29c2c688d7\",\"msgmobile\":\"13501784931\",\"smscode\":\"753166\",\"businesstype\":\"YFQ\",\"applyamt\":\"3400000\",\"cpcrcodes\":\"310000|310100|310101\",\"period\":\"12\",\"nation\":\"汉\",\"periodStep\":\"1\",\"userfullife\":\"20150508-20350508\",\"email\":\"68087825@qq.com\",\"applicant\":\"周佳庆\",\"ocrcertno\":\"510524199507105477\",\"debitcard\":\"6228480038388476970\",\"mobile\":\"13501784931\",\"busid\":\"applygeneralloan\",\"sex\":\"男\",\"ipv4\":\"101.228.13.47\",\"contactmobile\":\"13764087955\",\"emergencyrelation\":\"3\",\"ver\":\"94\",\"apcrcodes\":\"310000|310100|310104\",\"certno\":\"510524199507105477\",\"debitbank\":\"103\",\"telecode\":\"100290014389785\",\"cpcrnames\":\"上海市|上海市|黄浦区\",\"apcrnames\":\"上海市|上海市|徐汇区\",\"CREDIT_PRODUCTNO\":\"PK03\",\"sid\":\"LAKALAYD000201706233712000905831\",\"emergencyname\":\"梅伯迅\",\"stepUnit\":\"M\",\"termid\":\"CBC3A11002531759\",\"curcode\":\"156\",\"companyaddress\":\"延安东路333号1801室\",\"companyname\":\"上海市金睿投资管理有限公司\",\"channelsource\":\"A\",\"contactname\":\"万春红\",\"address\":\"宾南路36弄8号1703室\",\"registered\":\"上海市闸北区共和新路708弄1号1310室\",\"productName\":\"易分期还款12个月（新）\",\"channel\":\"APP\",\"companytel\":\"021-66288696\",\"lbs\":\"\\\"{\\\\\\\"lbsy\\\\\\\":\\\\\\\"121.431546\\\\\\\",\\\\\\\"lbsx\\\\\\\":\\\\\\\"31.162964\\\\\\\",\\\\\\\"lbsanalyzed\\\\\\\":\\\\\\\"上海市徐汇区宾南路\\\\\\\"}\\\"\"},\"merchantNo\":\"CreditLoan\",\"modelNo\":\"CreditGateway\",\"operateType\":\"ADD\",\"operateTypeEnum\":\"OperateTypeEnum_ADD\",\"process\":\"18671@creditloan02\",\"productNo\":\"YFQ\",\"protocolVersion\":\"1.0.5\",\"receiveTime\":1498185434375,\"sessionId\":\"XNA2017062317184712\",\"systemCode\":\"CreditLoan\"}";
            String data = "{\"sendTime\":\"2016-08-03 10:37:10\",\"cLoanApply\":{\"productNo\":\"PK03\",\"capitalAmount\":100000,\"creditMode\":\"1\",\"channelSource\":\"A\",\"termId\":\"CBC3A14400018587\",\"orgId\":\"orgyfq\",\"insertTime\":1470208784258,\"userId\":4400018587,\"contractNo\":\"XNA20160803023126\",\"flowStepId\":4,\"updateTime\":1476271690348,\"status\":\"1\",\"returnBankCode\":\"01030000\",\"manualAuthStatus\":\"AT\",\"creditAmount\":100000,\"capitalAmountFormat\":\"1000\",\"applyAmount\":100000,\"supplyStatus\":\"1\",\"returnDate\":1501689600000,\"id\":23126,\"rate\":140,\"businessNo\":\"YFQ\",\"orderId\":\"SXNA20141107021117287349\",\"loanBankCode\":\"01030000\",\"loanPan\":\"6228481099041613753\",\"teleCode\":\"100290010121588\",\"manualAuthUser\":1,\"workFlowId\":49,\"pbCreditLimit\":30000000,\"panAuthStatus\":\"T\",\"loanDate\":1470153600000,\"bodyCreditOrg\":\"J0000000019007\",\"returnPan\":\"6228481099041613753\"},\"cApplyUser\":{\"apcrCodes\":\"440000|440300|440305\",\"imgCheckStatus\":\"1\",\"idCertAddr\":\"南油大厦506\",\"userId\":4400018587,\"emergencyRelation\":\"2\",\"photoImg\":\"YFQ/2016-08-03/XNA20141107021117287315/986F587C0C9A4D4A931263A71929DF74.jpg\",\"apcrNames\":\"广东省|深圳市|南山区\",\"certFirstImg\":\"YFQ/2016-08-03/XNA20141107021117287315/7695F238555C42B1B869A92A5DB06092.jpg\",\"certSecondImg\":\"YFQ/2016-08-03/XNA20141107021117287315/B9C94283748047C9A5CFDB482D059D88.jpg\",\"email\":\"282734321@qq.com\",\"cpcrCodes\":\"440000|440300|440307\",\"contactName\":\"唐桶华\",\"rpflag\":\"1\",\"company\":\"拉卡拉有限公司\",\"authStatus\":\"1\",\"mobile\":\"13246775994\",\"certType\":\"1\",\"compAddr\":\"坂田岗头市场106号\",\"id\":23126,\"contactRelation\":\"1\",\"authType\":\"1\",\"compPhone\":\"0755-12345678\",\"emergencyContactMobile\":\"13246775996\",\"flags\":0,\"cpcrNames\":\"广东省|深圳市|龙岗区\",\"emergencyContactName\":\"胡良弹\",\"address\":\"南油大厦506\",\"certNo\":\"220523197809119159\",\"realName\":\"费建功\",\"contactMobile\":\"13246775997\"}}";
            try {
//                if(messageNo==9999){data ="exit"; throw new StringIndexOutOfBoundsException();}
                producer.send(new KeyedMessage<String, String>(TOPIC, key, data));
                messageNo++;
//                System.out.println(messageNo);
            }catch (Exception e){
                System.out.println(e.getMessage());
            }

        }
    }

    public static void main(String[] args) {
        new KafkaProducer().produce();
    }
}
